package cn.yjh.client;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @DESC:
 * @AUTHOR: YouJinhua
 * @DATE: 2021-11-23 20:12:08
 * @VERSION: 1.0
 */
public abstract class RPCHandler<T> implements InvocationHandler {

    protected String host;
    protected int port;
    protected Class<T> clazz;


    public RPCHandler(String host, int port,Class<T> clazz) {
        this.host = host;
        this.port = port;
        this.clazz = clazz;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Object result = null;
        result = this.doInvoke(proxy,method,args);
        return result;
    }

    protected abstract Object doInvoke(Object proxy, Method method, Object[] args) throws Throwable;
}
